<div>
    <h2>
        <span jhiTranslate="notebookWxappApp.message.home.title">Messages</span>
        <button class="btn btn-primary float-right jh-create-entity create-message" [routerLink]="['/', { outlets: { popup: ['message-new'] } }]">
            <span class="fa fa-plus"></span>
            <span  jhiTranslate="notebookWxappApp.message.home.createLabel">
            Create new Message
            </span>
        </button>
    </h2>
    <jhi-alert></jhi-alert>
    <div class="row">
    </div>
    <br/>
    <div class="table-responsive" *ngIf="messages">
        <table class="table table-striped">
            <thead>
            <tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
            <th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <span class="fa fa-sort"></span></th>
            <th jhiSortBy="content"><span jhiTranslate="notebookWxappApp.message.content">Content</span> <span class="fa fa-sort"></span></th>
            <th jhiSortBy="address"><span jhiTranslate="notebookWxappApp.message.address">Address</span> <span class="fa fa-sort"></span></th>
            <th jhiSortBy="open"><span jhiTranslate="notebookWxappApp.message.open">Open</span> <span class="fa fa-sort"></span></th>
            <th jhiSortBy="userId"><span jhiTranslate="notebookWxappApp.message.user">User</span> <span class="fa fa-sort"></span></th>
            <th></th>
            </tr>
            </thead>
            <tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
            <tr *ngFor="let message of messages ;trackBy: trackId">
                <td><a [routerLink]="['../message', message.id ]">{{message.id}}</a></td>
                <td>{{message.content}}</td>
                <td>{{message.address}}</td>
                <td>{{message.open}}</td>
                <td>
                    <div *ngIf="message.userId">
                        <a [routerLink]="['../wx-user', message.userId  ]" >{{message.userId}}</a>
                    </div>
                </td>
                <td class="text-right">
                    <div class="btn-group flex-btn-group-container">
                        <button type="submit"
                                [routerLink]="['../message', message.id ]"
                                class="btn btn-info btn-sm">
                            <span class="fa fa-eye"></span>
                            <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
                        </button>
                        <button type="submit"
                                [routerLink]="['/', { outlets: { popup: 'message/'+ message.id + '/edit'} }]"
                                replaceUrl="true"
                                queryParamsHandling="merge"
                                class="btn btn-primary btn-sm">
                            <span class="fa fa-pencil"></span>
                            <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
                        </button>
                        <button type="submit"
                                [routerLink]="['/', { outlets: { popup: 'message/'+ message.id + '/delete'} }]"
                                replaceUrl="true"
                                queryParamsHandling="merge"
                                class="btn btn-danger btn-sm">
                            <span class="fa fa-remove"></span>
                            <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
                        </button>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
